package com.cal.utms.entity;

import java.io.Serializable;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * The persistent class for the screen database table.
 * 
 */
@Entity
@Table(name = "screen")
@NamedQuery(name = "Screen.findAll", query = "SELECT s FROM Screen s")
public class Screen implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	private int id;

	private String description;

	@Column(name = "SCREEN_NAME")
	private String screenName;

	private String status;

	private String url;

	@OneToMany(fetch = FetchType.EAGER, mappedBy = "screen")
	private List<MenuItem> menuItems;

	@ManyToOne
	private Permission permission;

	// @LazyCollection(LazyCollectionOption.FALSE)
	// @OneToMany(mappedBy = "screen")
	// private List<UserGroupScreen> userGroupScreens;

	public Screen() {
	}

	public int getId() {
		return this.id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getScreenName() {
		return this.screenName;
	}

	public void setScreenName(String screenName) {
		this.screenName = screenName;
	}

	public String getStatus() {
		return this.status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public String getUrl() {
		return this.url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public List<MenuItem> getMenuItems() {
		return this.menuItems;
	}

	public void setMenuItems(List<MenuItem> menuItems) {
		this.menuItems = menuItems;
	}

	public MenuItem addMenuItem(MenuItem menuItem) {
		getMenuItems().add(menuItem);
		menuItem.setScreen(this);

		return menuItem;
	}

	public MenuItem removeMenuItem(MenuItem menuItem) {
		getMenuItems().remove(menuItem);
		menuItem.setScreen(null);

		return menuItem;
	}

	public Permission getPermission() {
		return this.permission;
	}

	public void setPermission(Permission permission) {
		this.permission = permission;
	}

	// public List<UserGroupScreen> getUserGroupScreens() {
	// return this.userGroupScreens;
	// }
	//
	// public void setUserGroupScreens(List<UserGroupScreen> userGroupScreens) {
	// this.userGroupScreens = userGroupScreens;
	// }
	//
	// public UserGroupScreen addUserGroupScreen(UserGroupScreen
	// userGroupScreen) {
	// getUserGroupScreens().add(userGroupScreen);
	// userGroupScreen.setScreen(this);
	//
	// return userGroupScreen;
	// }
	//
	// public UserGroupScreen removeUserGroupScreen(UserGroupScreen
	// userGroupScreen) {
	// getUserGroupScreens().remove(userGroupScreen);
	// userGroupScreen.setScreen(null);
	//
	// return userGroupScreen;
	// }

}